package net.form;

public class GridBoundingBox {
	
	private BoundingBox boundingBox;
	
	private int numberOfSquaresWidth;

	private int numberOfSquaresHeight;
	
	private double sizeGrid;
	
	public GridBoundingBox(BoundingBox boundingBox, int numberOfSquaresWidth,
			int numberOfSquaresHeight,double sizeGrid) {
		super();
		this.boundingBox = boundingBox;
		this.numberOfSquaresWidth=numberOfSquaresWidth;
		this.numberOfSquaresHeight=numberOfSquaresHeight;
		this.setSizeGrid(sizeGrid);
	}

	public BoundingBox getBoundingBox() {
		return boundingBox;
	}

	public void setBoundingBox(BoundingBox boundingBox) {
		this.boundingBox = boundingBox;
	}

	public int getNumberOfSquaresWidth() {
		return numberOfSquaresWidth;
	}

	public void setNumberOfSquaresWidth(int numberOfSquaresWidth) {
		this.numberOfSquaresWidth = numberOfSquaresWidth;
	}

	public int getNumberOfSquaresHeight() {
		return numberOfSquaresHeight;
	}

	public void setNumberOfSquaresHeight(int numberOfSquaresHeight) {
		this.numberOfSquaresHeight = numberOfSquaresHeight;
	}
	
	public int getWidth() {
		if (boundingBox != null) {
			return Math.abs((int) boundingBox.getMaxX()
					- (int) boundingBox.getMinX());
		}
		return 0;
	}

	public int getHeight() {
		if (boundingBox != null) {
			return Math.abs((int) boundingBox.getMaxY()
					- (int) boundingBox.getMinY());
		}
		return 0;
	}

	public double getSizeGrid() {
		return sizeGrid;
	}

	public void setSizeGrid(double sizeGrid) {
		this.sizeGrid = sizeGrid;
	}
}